home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / netInet.h < prev    next >
C/C++ Source or Header  |  1989-06-23  |  18KB  |  594 lines

  1. /*
  2.  * netInet.h --
  3.  *
  4.  *    Declarations of data structures and constants for the DARPA Internet 
  5.  *    protocol suite.
  6.  *
  7.  * Copyright 1987, 1988 Regents of the University of California
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software and its documentation for any purpose and without
  10.  * fee is hereby granted, provided that the above copyright
  11.  * notice appear in all copies.  The University of California
  12.  * makes no representations about the suitability of this
  13.  * software for any purpose.  It is provided "as is" without
  14.  * express or implied warranty.
  15.  *
  16.  * $Header: /sprite/src/lib/include/RCS/netInet.h,v 1.6 89/06/23 11:30:13 rab Exp $ SPRITE (Berkeley)
  17.  */
  18.  
  19. #ifndef _NETINET
  20. #define _NETINET
  21.  
  22. #include "machparam.h"
  23. #include "netEther.h"
  24.  
  25.  
  26. /*
  27.  * Definition of the 32-bit Internet Address.
  28.  */
  29.  
  30. typedef unsigned int Net_InetAddress;
  31.  
  32.  
  33. /*
  34.  * Structure of the Ethernet Address Resolution Protocol and Reverse ARP 
  35.  * packets, according to RFC826 (ARP) and RFC903 (RARP).
  36.  */
  37. typedef struct { 
  38.     unsigned short    hardwareType;        /* "Hardware address space (e.g.
  39.                          * Ethernet, Packet Radio Net.)"
  40.                          */
  41.     unsigned short    protocolType;        /* "Protocol Address Space"
  42.                          * specifies format of protocol
  43.                          * addresses. Value is one
  44.                          * of the defined packet types 
  45.                          * in netEther.h. */
  46.     unsigned char    hardwareAddrLen;    /* length in bytes of hardware
  47.                          * addresses. */
  48.     unsigned char    protocolAddrLen;    /* length in bytes of protocol
  49.                          * addresses. */
  50.     unsigned short    opcode;            /* see below. */
  51. }  Net_ArpHeader;
  52.  
  53. typedef struct {
  54.     Net_EtherHdr    header;            /* packet header */
  55.     unsigned short    hardwareType;        /* "Hardware address space (e.g.
  56.                          * Ethernet, Packet Radio Net.)"
  57.                          */
  58.     unsigned short    protocolType;        /* "Protocol Address Space"
  59.                          * specifies format of protocol
  60.                          * addresses. Value is one
  61.                          * of the defined packet types 
  62.                          * in netEther.h. */
  63.     unsigned char    hardwareAddrLen;    /* length in bytes of hardware
  64.                          * addresses. */
  65.     unsigned char    protocolAddrLen;    /* length in bytes of protocol
  66.                          * addresses. */
  67.     unsigned short    opcode;            /* see below. */
  68.     Net_EtherAddress    senderEtherAddr;    /* hardware address of sender
  69.                          * of the packet. */
  70.     Net_InetAddress    senderProtAddr;        /* protocol address of sender
  71.                          * of the packet. */
  72.     Net_EtherAddress    targetEtherAddr;    /* hardware address of target
  73.                          * (if known). */
  74.     Net_InetAddress    targetProtAddr;        /* protocol address of target.*/
  75. } Net_ArpPacket;
  76.  
  77. /*
  78.  * Value for the hardwareType field in Net_ArpPacket.
  79.  *   NET_ARP_TYPE_ETHER         using ethernet hardware.
  80.  */
  81.  
  82. #define NET_ARP_TYPE_ETHER    1
  83.  
  84. /*
  85.  * Values for the opcode field in Net_ArpPacket:
  86.  *   NET_ARP_REQUEST        request ethernet address for a given IP address.
  87.  *   NET_ARP_REPLY        answer for above request.
  88.  *   NET_RARP_REQUEST        request IP address for a given ethernet address.
  89.  *   NET_RARP_REPLY        answer for above request.
  90.  */
  91.  
  92. #define NET_ARP_REQUEST        1
  93. #define NET_ARP_REPLY        2
  94. #define NET_RARP_REQUEST    3
  95. #define NET_RARP_REPLY        4
  96.  
  97.  
  98.  
  99. #define NET_INET_BROADCAST_ADDR        ((Net_InetAddress) 0xFFFFFFFF)
  100. #define NET_INET_ANY_ADDR        ((Net_InetAddress) 0)
  101.  
  102. #define NET_INET_CLASS_A_ADDR(addr) \
  103.             (((unsigned int)(addr) & 0x80000000) == 0)
  104. #define NET_INET_CLASS_A_HOST_MASK        0x00FFFFFF
  105. #define NET_INET_CLASS_A_NET_MASK        0xFF000000
  106. #define NET_INET_CLASS_A_SHIFT            24
  107.  
  108. #define NET_INET_CLASS_B_ADDR(addr) \
  109.             (((unsigned int)(addr) & 0xC0000000) == 0x80000000)
  110. #define NET_INET_CLASS_B_HOST_MASK        0x0000FFFF
  111. #define NET_INET_CLASS_B_NET_MASK        0xFFFF0000
  112. #define NET_INET_CLASS_B_SHIFT            16
  113.  
  114. #define NET_INET_CLASS_C_ADDR(addr) \
  115.             (((unsigned int)(addr) & 0xE0000000) == 0xC0000000)
  116. #define NET_INET_CLASS_C_HOST_MASK        0x000000FF
  117. #define NET_INET_CLASS_C_NET_MASK        0xFFFFFF00
  118. #define NET_INET_CLASS_C_SHIFT            8
  119.  
  120. /*
  121.  * Class D: multicast addressing (see RFC988, RFC966).
  122.  */
  123. #define NET_INET_CLASS_D_ADDR(addr) \
  124.             (((unsigned int)(addr) & 0xF0000000) == 0xE0000000)
  125. #define NET_INET_CLASS_D_NET_MASK        0x0FFFFFFF
  126.  
  127. /*
  128.  * Class E: reserved.
  129.  */
  130. #define NET_INET_CLASS_E_ADDR(addr) \
  131.             (((unsigned int)(addr) & 0xF0000000) == 0xF0000000)
  132.  
  133. /*
  134.  * Synonym address for the local host.
  135.  */
  136. #define NET_INET_LOCAL_HOST        0x7F000001
  137.  
  138.  
  139.  
  140. /*
  141.  * Structure of an Internet packet header, according to RFC791.
  142.  */
  143.  
  144. typedef struct {
  145. #if  BYTE_ORDER == LITTLE_ENDIAN
  146.     unsigned int    headerLen:4,    /* Length of header in 32-bit words. */
  147.             version:4;    /* Version. Defined below. */
  148. #else
  149.     unsigned int    version:4,
  150.             headerLen:4;
  151. #endif
  152.     unsigned char    typeOfService;    /* See below. */
  153.     unsigned short    totalLen;    /* Length in bytes of the 
  154.                      * datagram including header and data.*/
  155.     unsigned short    ident;        /* Used for fragmentation reassembly. */
  156. #if BYTE_ORDER == LITTLE_ENDIAN
  157.     unsigned int    fragOffset:13,    /* Offset from beginning of unfragmented
  158.                      * packet. */
  159.             flags:3;    /* Fragment flags. See below. */
  160. #else
  161.     unsigned int    flags:3,
  162.             fragOffset:13;
  163. #endif
  164.     unsigned char    timeToLive;    /* Max. time the packet is allowed to
  165.                      * be in the internet system. When TTL
  166.                      * goes to 0, the packet is destroyed.*/
  167.     unsigned char    protocol;    /* Protocol used in the data portion.
  168.                      * Defined below. */
  169.     unsigned short    checksum;    /* Checksum of the header. */
  170.     Net_InetAddress    source;        /* Source of the packet. */
  171.     Net_InetAddress    dest;        /* Destination of the packet. */
  172.     /*
  173.      * Options may follow at this point, before the data.
  174.      */
  175. } Net_IPHeader;
  176.  
  177. /*
  178.  * IP Pseudo Header is used by UDP and TCP checksums to make sure
  179.  * the packet is not mis-routed.
  180.  */
  181. typedef struct {
  182.     Net_InetAddress    source;        /* Source of the packet. */
  183.     Net_InetAddress    dest;        /* Destination of the packet. */
  184.     unsigned char    zero;        /* must be zero. */
  185.     unsigned char    protocol;    /* Protocol # (UDP, TCP). */
  186.     unsigned short    len;        /* # of bytes in header and data. */
  187. } Net_IPPseudoHdr;
  188.  
  189. #define NET_IP_VERSION        4
  190. #define NET_IP_MAX_HDR_SIZE    60
  191.  
  192. /*
  193.  * IP implementation parameters:
  194.  *  NET_IP_MAX_TTL        - Max. value for timeToLive field (in seconds).
  195.  *  NET_IP_MAX_FRAG_TTL        - Max. time-to-live for fragments.
  196.  *  NET_IP_TTL_DECR        - The value ttl is decremented by when a 
  197.  *                   packet is forwarded.
  198.  *  NET_IP_MAX_SEG_SIZE        - Max. segment size.
  199.  *  NET_IP_MAX_PACKET_SIZE    - Largest packet size.
  200.  */
  201.  
  202. #define NET_IP_MAX_TTL            255
  203. #define NET_IP_MAX_FRAG_TTL        15
  204. #define NET_IP_TTL_DECR            1
  205. #define NET_IP_MAX_SEG_SIZE        576
  206. #define NET_IP_MAX_PACKET_SIZE        65535
  207.  
  208. /*
  209.  * Definitions of the typeOfService flags in the Internet header.
  210.  * According to p. 12 of RFC791, the type of service field has the
  211.  * the following subfields:
  212.  *    precedence:    bits 0-2    (most sig. bits)
  213.  *     delay        bit  3
  214.  *     thruput        bit  4
  215.  *     reliability    bit  5
  216.  *     reserved    bit  6-7    (least sig. bits)
  217.  * The value must be composed of the OR of one flag from each of the following
  218.  * groups:
  219.  */
  220.  
  221. #define NET_IP_SERV_PREC_NET_CTL    0xE0
  222. #define NET_IP_SERV_PREC_INET_CTL    0xC0
  223. #define NET_IP_SERV_PREC_CRITIC        0xA0
  224. #define NET_IP_SERV_PREC_FLASH_OVR    0x80
  225. #define NET_IP_SERV_PREC_FLASH        0x60
  226. #define NET_IP_SERV_PREC_IMMED        0x40
  227. #define NET_IP_SERV_PREC_PRIORITY    0x20
  228. #define NET_IP_SERV_PREC_ROUTINE    0x00
  229.  
  230. #define NET_IP_SERV_NORM_DELAY        0x00
  231. #define NET_IP_SERV_LOW_DELAY        0x10
  232.  
  233. #define NET_IP_SERV_NORM_THRUPUT    0x00
  234. #define NET_IP_SERV_HIGH_THRUPUT    0x08
  235.  
  236. #define NET_IP_SERV_NORM_RELIABL    0x00
  237. #define NET_IP_SERV_HIGH_RELIABL    0x04
  238.  
  239. /*
  240.  * Values for the flags field in the IP header.
  241.  *    NET_IP_LAST_FRAG    last fragment of the bunch. implies the
  242.  *                packet can be fragmented if necessary.
  243.  *    NET_IP_MORE_FRAGS    expect more fragments.
  244.  *    NET_IP_DONT_FRAG    the can't be fragmented so discard if can't
  245.  *                transmit.
  246.  *
  247.  * The high-order bit of the field must be 0.
  248.  */
  249.  
  250. #define NET_IP_LAST_FRAG        0x0
  251. #define NET_IP_MORE_FRAGS        0x1
  252. #define NET_IP_DONT_FRAG        0x2
  253.  
  254.  
  255. /*
  256.  * Values for the protocol field in the IP packet header from RFC990.
  257.  * The RFC does not assign a number for IP, so we use 0 (even though
  258.  * it is reserved).
  259.  */
  260.  
  261. #define NET_IP_PROTOCOL_IP        0
  262. #define NET_IP_PROTOCOL_ICMP        1
  263. #define NET_IP_PROTOCOL_TCP        6
  264. #define NET_IP_PROTOCOL_EGP        8
  265. #define NET_IP_PROTOCOL_UDP        17
  266. #define NET_IP_PROTOCOL_SPRITE        90
  267.  
  268.  
  269. /*
  270.  * Definitions of IP options.
  271.  * There are two formats for the options:
  272.  *   1) single octet of option-type.
  273.  *   2) an option-type octet, an option length, and the actual data octets.
  274.  *
  275.  * The option type is composed of 3 fields: copied flag (1 bit), 
  276.  * option class (2 bits), and an option number (5 bits).
  277.  */
  278.  
  279. /*
  280.  * Definitions of offsets within an option for the type, length and next-
  281.  * option-offset octets. The minimum value for the next-option offset 
  282.  * ("pointer") is 4.  The pointer is used in the 3 routing options and 
  283.  * the timestamp option.
  284.  */
  285. #define NET_IP_OPT_TYPE_OFFSET        0
  286. #define NET_IP_OPT_LEN_OFFSET        1
  287. #define NET_IP_OPT_PTR_OFFSET        2
  288. #define NET_IP_OPT_MIN_PTR        4
  289.  
  290. #define NET_IP_OPT_MAX_LEN        40
  291.  
  292. /*
  293.  * Macros to access the option-type fields.
  294.  *  NET_IP_OPT_COPIED    - 0 means not copied, 1 means copied.
  295.  *  NET_IP_OPT_CLASS    - see below.
  296.  *  NET_IP_OPT_NUMBER    - see below.
  297.  */
  298.  
  299. #define NET_IP_OPT_COPIED(opt)        ((opt) & 0x80)
  300. #define NET_IP_OPT_CLASS(opt)        ((opt) & 0x60)
  301. #define NET_IP_OPT_NUMBER(opt)        ((opt) & 0x1f)
  302.  
  303. /*
  304.  * Values for NET_IP_OPT_CLASS as masks.
  305.  */
  306. #define NET_IP_OPT_CLASS_CONTROL        0x00
  307. #define NET_IP_OPT_CLASS_RESERVED1        0x20
  308. #define NET_IP_OPT_CLASS_DEBUG            0x40
  309. #define NET_IP_OPT_CLASS_RESERVED2        0x60
  310.  
  311. /*
  312.  * Complete values for the option types, including the copied and class fields
  313.  * as well as the number field.   The definitions are listed in the same 
  314.  * order as described in RFC791, p. 16ff.
  315.  */
  316.  
  317. #define NET_IP_OPT_END_OF_LIST        0x00
  318. #define NET_IP_OPT_NOP            0x01
  319. #define NET_IP_OPT_SECURITY        0x82
  320. #define NET_IP_OPT_LOOSE_ROUTE        0x83
  321. #define NET_IP_OPT_STRICT_ROUTE        0x89
  322. #define NET_IP_OPT_REC_ROUTE        0x07
  323. #define NET_IP_OPT_STREAM_ID        0x88
  324. #define NET_IP_OPT_TIMESTAMP        0x44
  325.  
  326. /*
  327.  * Foramt of the timestamp option header.
  328.  */
  329. typedef struct {
  330.     unsigned char    type;
  331.     unsigned char    len;            /* Total len of option. */
  332.     unsigned char    pointer;        /* Offset into option where
  333.                          * to add t.s. */
  334. #if  BYTE_ORDER == LITTLE_ENDIAN
  335.     unsigned int    flags:4,        /* Defined below. */
  336.             overflow:4;        /* # of hosts who weren't
  337.                          * able to add a t.s. */
  338. #else
  339.     unsigned int    overflow:4,
  340.             flags:4;
  341. #endif
  342. } Net_IPTimestampHdr;
  343.  
  344. /*
  345.  *  Values of the flags field in Net_IPTimestampHdr.
  346.  */
  347. #define NET_IP_OPT_TS_ONLY        0
  348. #define NET_IP_OPT_TS_AND_ADDR        1
  349. #define NET_IP_OPT_TS_ADDR_SPEC        3
  350.  
  351. /*
  352.  * Interet time value is a "right-justified, 32-bit" time in milliseconds
  353.  * since midnight Universal Time (UT).
  354.  */
  355. typedef int Net_InetTime;
  356.  
  357.  
  358. /*
  359.  * Structure of an TCP packet header, according to RFC793.
  360.  */
  361.  
  362. typedef struct {
  363.     unsigned short    srcPort;    /* Source port # */
  364.     unsigned short    destPort;    /* Destination port # */
  365.     unsigned int    seqNum;        /* Seq. # of 1st byte in the segment */
  366.     unsigned int    ackNum;        /* Next seq. # we expect */
  367. #if BYTE_ORDER == LITTLE_ENDIAN
  368.     unsigned int    reserved1:4,    /* Must be zero. */
  369.             dataOffset:4,    /* # of 32-bit words in this header */
  370.             flags:6,    /* Control flags, define below. */
  371.             reserved2:2;    /* Must be zero */
  372. #else
  373.     unsigned int    dataOffset:4,
  374.             reserved:6,
  375.             flags:6;
  376. #endif
  377.     unsigned short    window;        /* # of bytes we are willing to accept*/
  378.     unsigned short    checksum;    /* Checksum of IP pseudo-header, 
  379.                      * TCP header and data. */
  380.     unsigned short    urgentOffset;    /* Start of urgent data as an offset
  381.                      * from the seq. # of this segment. */
  382. } Net_TCPHeader;
  383.  
  384. #define NET_TCP_MAX_HDR_SIZE    60
  385. #define NET_TCP_TTL        30
  386.  
  387. /*
  388.  * TCP header control flags: (p. 16, rfc793)
  389.  *
  390.  *    URG -  Urgent Pointer field significant
  391.  *    ACK -  Acknowledgment field significant
  392.  *    PSH -  Push Function
  393.  *    RST -  Reset the connection
  394.  *    SYN -  Synchronize sequence numbers
  395.  *    FIN -  No more data from sender
  396.  */
  397.  
  398. #define NET_TCP_FIN_FLAG    0x01
  399. #define NET_TCP_SYN_FLAG    0x02
  400. #define NET_TCP_RST_FLAG    0x04
  401. #define NET_TCP_PSH_FLAG    0x08
  402. #define NET_TCP_ACK_FLAG    0x10
  403. #define NET_TCP_URG_FLAG    0x20
  404.  
  405.  
  406. /*
  407.  * TCP options flags:        (p. 16, rfc793)
  408.  *    EOL        - End of option list
  409.  *    NOP        - No-operation
  410.  *    MAX_SEG_SIZE    - Maximum segment size
  411.  */
  412.  
  413. #define NET_TCP_OPTION_EOL        0x0
  414. #define NET_TCP_OPTION_NOP        0x1
  415. #define NET_TCP_OPTION_MAX_SEG_SIZE    0x2
  416.  
  417. #define NET_TCP_MAX_SEG_SIZE        512
  418.  
  419.  
  420.  
  421. /*
  422.  * Structure of an UDP packet header, according to RFC768.
  423.  */
  424.  
  425. typedef struct {
  426.     unsigned short    srcPort;    /* Source port. */
  427.     unsigned short    destPort;    /* Destination port. */
  428.     unsigned short    len;        /* # of bytes in header and data. */
  429.     unsigned short    checksum;    /* Checksum of IP pseudo-header,
  430.                      * UDP header and data. */
  431. } Net_UDPHeader;
  432.  
  433. #define NET_UDP_TTL            30
  434.  
  435.  
  436. /*
  437.  * Structure of various ICMP packets, according to RFC792.
  438.  * The data structures for ICMP data is broken into 2 parts: 
  439.  * a 4-byte header that is common to all ICMP packet types and
  440.  * a type-dependent data part.
  441.  *
  442.  * The packets that include the IP header + the first 64 bits of data
  443.  * consist of the basic header, plus room for the header options followed
  444.  * by space for the data. Enough space to hold the maximum amount of
  445.  * header options is reserved; if the size of the options is smaller than
  446.  * maximum, the 64 bits of data will be placed immediately after the end
  447.  * of the options. Therefore the "char data[8]" field is there to reserve
  448.  * space in case of a maximum-sized header is present.
  449.  */
  450.  
  451. typedef struct {
  452.     unsigned char    type;        /* Type of message, define below. */
  453.     unsigned char    code;        /* Type sub code, define below. */
  454.     unsigned short    checksum;    /* Checksum of ICMP message. */
  455. } Net_ICMPHeader;
  456.  
  457. /*
  458.  * Data for "Destination unreachable", "Time exceeded", 
  459.  *  "Source Quench" messages.
  460.  */
  461. typedef struct {
  462.     int            unused;    
  463.     Net_IPHeader    ipHeader;
  464.     char        hdrOptions[NET_IP_MAX_HDR_SIZE - sizeof(Net_IPHeader)];
  465.     char        data[8];
  466. } Net_ICMPDataMisc;
  467.  
  468. /*
  469.  * Data for "Redirect" message.
  470.  */
  471. typedef struct {
  472.     Net_InetAddress    gatewayAddr;
  473.     Net_IPHeader    ipHeader;
  474.     char        hdrOptions[NET_IP_MAX_HDR_SIZE - sizeof(Net_IPHeader)];
  475.     char        data[8];
  476. } Net_ICMPDataRedir;
  477.  
  478. /*
  479.  * Data for "Parameter Problem" message.
  480.  */
  481. typedef struct {
  482.     unsigned char    paramOffset;
  483.     char        unused1;
  484.     short        unused2;
  485.     Net_IPHeader    ipHeader;
  486.     char        hdrOptions[NET_IP_MAX_HDR_SIZE - sizeof(Net_IPHeader)];
  487.     char        data[8];
  488. } Net_ICMPDataParam;
  489.  
  490. /*
  491.  * Data for "Information Request", "Information Reply", "Echo" and "Echo Reply"
  492.  * messages. The echo messages also have additional data following.
  493.  */
  494. typedef struct {
  495.     unsigned short    id;
  496.     unsigned short    seqNum;
  497. } Net_ICMPDataInfoEcho;
  498.  
  499.  
  500. /*
  501.  * Data for "Address Mask Request" and "Address Mask Reply" messages.
  502.  */
  503. typedef struct {
  504.     unsigned short    id;
  505.     unsigned short    seqNum;
  506.     unsigned int    addrMask;
  507. } Net_ICMPDataMask;
  508.  
  509. /*
  510.  * Data for "Timestamp" and "Timestamp Reply" message.
  511.  */
  512. typedef struct {
  513.     unsigned short    id;
  514.     unsigned short    seqNum;
  515.     unsigned int    origTime;
  516.     unsigned int    recvTime;
  517.     unsigned int    transmitTime;
  518. } Net_ICMPDataTime;
  519.  
  520.  
  521. /*
  522.  * A complete definition of an ICMP packet.
  523.  */
  524.  
  525. typedef struct {
  526.     Net_ICMPHeader    header;
  527.     union {
  528.     Net_ICMPDataMisc    overlay;    /* used to format packets that
  529.                          * return the IP header & data*/
  530.     Net_ICMPDataMisc    unreach;    /* NET_ICMP_UNREACHABLE */
  531.     Net_ICMPDataMisc    timeExceed;    /* NET_ICMP_TIME_EXCEED */
  532.     Net_ICMPDataMisc    quench;        /* NET_ICMP_SOURCE_QUENCH */
  533.     Net_ICMPDataParam    param;        /* NET_ICMP_PARAM_PROB */
  534.     Net_ICMPDataRedir    redirect;    /* NET_ICMP_REDIRECT */
  535.     Net_ICMPDataTime    timeStamp;    /* NET_ICMP_TIMESTAMP, _REPLY */
  536.     Net_ICMPDataMask    mask;        /* NET_ICMP_MASK_REQ, _REPLY */
  537.     Net_ICMPDataInfoEcho    info;        /* NET_ICMP_INFO_REQ , _REPLY */
  538.     Net_ICMPDataInfoEcho    echo;        /* NET_ICMP_ECHO, _REPLY */
  539.     } data;
  540. } Net_ICMPPacket;
  541.  
  542. #define NET_ICMP_MIN_LEN    8
  543.  
  544. /*
  545.  * Definition of type and code field values.
  546.  */
  547.  
  548. #define    NET_ICMP_ECHO_REPLY        0    /* Echo reply */
  549.  
  550. #define    NET_ICMP_UNREACHABLE        3    /* Dest unreachable, codes: */
  551. #define     NET_ICMP_UNREACH_NET           0    /*  - Bad net */
  552. #define     NET_ICMP_UNREACH_HOST           1    /*  - Bad host */
  553. #define     NET_ICMP_UNREACH_PROTOCOL       2    /*  - Bad protocol */
  554. #define     NET_ICMP_UNREACH_PORT           3    /*  - Bad port */
  555. #define     NET_ICMP_UNREACH_NEED_FRAG       4    /*  - IP_DF caused drop */
  556. #define     NET_ICMP_UNREACH_SRC_ROUTE       5    /*  - Source route failed */
  557.  
  558. #define    NET_ICMP_SOURCE_QUENCH        4    /* Source quench */
  559. #define    NET_ICMP_REDIRECT        5    /* Shorter route, codes: */
  560. #define     NET_ICMP_REDIRECT_NET           0    /*  - For network */
  561. #define     NET_ICMP_REDIRECT_HOST           1    /*  - For host */
  562. #define     NET_ICMP_REDIRECT_TOS_NET       2    /*  - For type of service and 
  563.                          *    net. */
  564. #define     NET_ICMP_REDIRECT_TOS_HOST       3    /*  - For type of service and 
  565.                          *     host. */
  566. #define    NET_ICMP_ECHO            8    /* Echo service */
  567. #define    NET_ICMP_TIME_EXCEED        11    /* Time exceeded, code: */
  568. #define     NET_ICMP_TIME_EXCEED_TTL       0    /*  - ttl==0 in transit */
  569. #define     NET_ICMP_TIME_EXCEED_REASS       1    /*  - ttl==0 in reassembly */
  570. #define    NET_ICMP_PARAM_PROB        12    /* IP header bad */
  571. #define    NET_ICMP_TIMESTAMP        13    /* Timestamp request */
  572. #define    NET_ICMP_TIMESTAMP_REPLY    14    /* Timestamp reply */
  573. #define    NET_ICMP_INFO_REQ        15    /* Information request */
  574. #define    NET_ICMP_INFO_REPLY        16    /* Information reply */
  575. #define    NET_ICMP_MASK_REQ        17    /* Address mask request */
  576. #define    NET_ICMP_MASK_REPLY        18    /* Address mask reply */
  577.  
  578. #define    NET_ICMP_MAX_TYPE        18
  579.  
  580.  
  581. /*
  582.  * Definition of a socket address. To be compatible with the Unix sockaddr_in
  583.  * structure, there are address family and padding fields. They aren't used
  584.  * by the Sprite Internet server.
  585.  */
  586. typedef struct {
  587.     short        addrFamily;    /* For Unix compatibilty, == AF_INET */
  588.     unsigned short    port;
  589.     Net_InetAddress    address;
  590.     char        padding[8];    /* Not used. */
  591. } Net_InetSocketAddr;
  592.  
  593. #endif /* _NETINET */
  594.